import request from '../utils/request';
import { get } from '../utils/uniapi';
const mop = '/mop/api';
const scope = 'mop';

export class api {
	//商家登录
	static moplogin(data: any) {
		return request(mop, { scope, cmdCode: 'MCH_MEMBER_POST', source: JSON.stringify(data) });
	}
	//店铺列表
	static mopList() {
		return request(mop, {
			scope,
			cmdCode: 'MCH_LIST',
			token: get('token')
		});
	}
	//商品类型创建
	static newtype(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_CAT_POST',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//商品类型列表
	static typelist(data: { page: any; size: any }) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_CAT_LIST',
			mchId: get('mchId'),
			pageIndex: data.page,
			pageSize: data.size
		});
	}
	//商品类型详情
	static typeget(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_CAT_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//商品类型修改
	static typeput(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			mchId: get('mchId'),
			cmdCode: 'GOODS_CAT_PATCH',
			source: JSON.stringify(data)
		});
	}
	//商品类型删除
	static typedel(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			mchId: get('mchId'),
			cmdCode: 'GOODS_CAT_DEL',
			source: JSON.stringify(data)
		});
	}
	//商品列表
	static goodList(data: { page: any; size: any; data: any }) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_LIST',
			mchId: get('mchId'),
			pageIndex: data.page,
			pageSize: data.size,
			source: JSON.stringify(data.data)
		});
	}
	//商品详情
	static goodGet(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//商品修改
	static goodPut(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_PATCH',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//商品删除
	static goodDel(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_DEL',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//商品上下架
	static goodsta(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_PATCH',
			mchId: get('mchId'),
			reqCode: 'UPDATE_STATUS',
			source: JSON.stringify(data)
		});
	}
	//商品添加
	static goodpost(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'GOODS_POST',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//用户列表
	static viplist(data: { page: any; size: any }) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MEMBER_LIST',
			mchId: get('mchId'),
			pageIndex: data.page,
			pageSize: data.size,
			source: "{'isVip':1}"
		});
	}
	//用户详情
	static vipget(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MEMBER_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//修改用户状态
	static vipPut(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MEMBER_PATCH',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//充值积分
	static give_points(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'PAY_PAYMENT_POST',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	static points_del(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			mchId: get('mchId'),
			cmdCode: 'MEMBER_POINTS_DEDUCT',
			source: JSON.stringify(data)
		});
	}
	//订单列表
	static orderlist(data: { page: any; size: any }) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'ORDERS_LIST',
			mchId: get('mchId'),
			pageIndex: data.page,
			pageSize: data.size
		});
	}
	//订单详情
	static orderget(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'ORDERS_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//订单修改
	static orderput(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'ORDERS_PATCH',
			mchId: get('mchId'),
			source: JSON.stringify(data),
			token: get('token')
		});
	}
	//餐桌列表
	static board_list(data: { page: any; size: any }) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MCH_DESK_LIST',
			mchId: get('mchId'),
			pageIndex: data.page,
			pageSize: data.size
		});
	}
	//餐桌详情
	static board_get(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MCH_DESK_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//餐桌修改
	static board_put(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MCH_DESK_PATCH',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//餐桌新增
	static board_post(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MCH_DESK_POST',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//餐桌删除
	static board_del(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'MCH_DESK_DEL',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//日营收
	static daydata(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'STAT_MCH_DAY_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//月营收
	static monthdata(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'STAT_MCH_MONTH_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//年营收
	static yeardata(data: any) {
		return request(mop, {
			scope,
			token: get('token'),
			cmdCode: 'STAT_MCH_YEAR_GET',
			mchId: get('mchId'),
			source: JSON.stringify(data)
		});
	}
	//会员积分流水
	static moppoints(data: { page: any; size: any }) {
		return request(mop, {
			scope,
			cmdCode: 'MEMBER_FINANCE_LOG_LIST',
			mchId: get('mchId'),
			token: get('token'),
			pageIndex: data.page,
			pageSize: data.size
		});
	}
	//充值活动列表
	static payhdList(data: { page: any; size: any }) {
		return request(mop, {
			scope,
			cmdCode: 'MKT_POINTS_LIST',
			mchId: get('mchId'),
			pageIndex: data.page,
			pageSize: data.size,
			token: get('token')
		});
	}
	//充值活动详情
	static payhdGet(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'MKT_POINTS_GET',
			source: JSON.stringify(data),
			mchId: get('mchId'),
			token: get('token')
		});
	}
	//修改充值活动状态
	static paystaput(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'MKT_POINTS_PATCH',
			mchId: get('mchId'),
			reqCode: 'UPDATE_STATUS',
			source: JSON.stringify(data),
			token: get('token')
		});
	}
	//修改充值活动
	static payhdput(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'MKT_POINTS_PATCH',
			mchId: get('mchId'),
			source: JSON.stringify(data),
			token: get('token')
		});
	}
	//删除充值活动
	static payhdDel(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'MKT_POINTS_DEL',
			mchId: get('mchId'),
			source: JSON.stringify(data),
			token: get('token')
		});
	}
	//充值活动新增
	static payhdpost(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'MKT_POINTS_POST',
			reqCode: 'UPDATE_STATUS',
			mchId: get('mchId'),
			token: get('token'),
			source: JSON.stringify(data)
		});
	}
	//退款列表
	static payrefundList(data: { page: any; size: any; data: any }) {
		return request(mop, {
			scope,
			cmdCode: 'ORDERS_RETURN_LIST',
			mchId: get('mchId'),
			token: get('token'),
			pageIndex: data.page,
			pageSize: data.size,
			source: JSON.stringify(data.data)
		});
	}
	//退款审核
	static payrefund(data: any) {
		return request(mop, {
			scope,
			cmdCode: 'ORDERS_RETURN_PATCH',
			mchId: get('mchId'),
			token: get('token'),
			reqCode: 'RETURN_ORDERS_AUDIT',
			source: JSON.stringify(data)
		});
	}
}
